<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/admin.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo $this->_webroot('skin/css/main.css'); ?>">
<script type='text/javascript' src="<?php echo $this->_webroot('skin/js/jy.js'); ?>"></script>
<style>
td span {color:red;}
.green {color:green;}
.red {color:red;}
#divname{float:left; margin:0px;}
</style>
</head>
<body>
<input type="hidden" id="update_right" value="1" ></input>
<div id="maincontent">
	<div class="wrap">
    <div class="crumbs">当前位置 &gt;&gt; <a href="">交易管理</a> &gt;&gt; <a href="">所有订单列表</a></div>
        <hr />
	<div class="seachbox">
        <div class="content2">
        	<form action="<?php echo $this->_url('admin/order/index/?');?>" name="searchForm" method="get">
            <table class="form-table">
            	<tbody>
            	<tr>
                   	<td width="2px" style="padding:0 0 0 5px"><span style="margin:1px 0px 0px 0px; float:left; color: #000" > <img src="<?php echo $this->_webroot('skin/images/icon_search.gif'); ?>" border="0" alt="SEARCH" /> </span></td>
                    <td>订单ID：
                   		<input class="small-text" type="text" name="payid" value="<?php echo $payid; ?>" style="width:120px" />
                    	商家收款方式：
                    	<select name="pay_id">
							<option value="0">选择收款方式</option>
							<?php foreach($payment as $value) { ?>
							<option value="<?php echo $value['id']; ?>" <?php if($pay_id==$value['id']){echo "selected";} ?> ><?php echo $value['pay_name'];?></option>
							<?php } ?>
						</select>
                    	订单状态： 						
						<select name="order_status">
							<option value="0">所有</option>
							<option value="1" <?php if($order_status==1){echo "selected";} ?> >客户下订单</option>
							<option value="2" <?php if($order_status==2){echo "selected";} ?> >商家确认订单</option>
							<option value="3" <?php if($order_status==3){echo "selected";} ?> >客户验货</option>
						</select>
						已支付<input type="checkbox" name="pay_status" value="1" <?php if($pay_status) echo "checked";?> />
						已发货<input type="checkbox" name="transport_status" value="1" <?php if($transport_status) echo "checked";?> />
					</td>
					<td align="left"><input class="regular-button" type="submit" value="搜索" /></td>
                  </tr>
                </tbody>
            </table>
           </form>
        </div>
    </div>	
		
	<div class="infobox">
	<h3>所有订单列表</h3>
    <div class="content2">
		<form action="<?php echo $this->_url('admin/order/setstatus/');?>" name="postForm" method="post" onsubmit="return submitform();">
		<table class="list_table">
			<thead>
            <tr style=" text-align:center">
				<th width="5px"><input type="checkbox" onclick="checkall(this,'order_id[]');"></th>
				<th width="115px">订单ID</th>
				<th width="" align="left">商品/商家名称</th>
				<th width="90px">商品价格/运费</th>
				<th width="120px">购买数量/订单总价</th>
				<th width="115px">收款方式/订单时间</th>
				<th width="60px">状态</th>
				<th width="45px">操作</th>
			</tr>
			</thead>
			<tbody>
			<?php if($result['data']) {
			foreach($result['data'] as $value) { $value= $value['orderinfo']; ?>
			<tr style=" text-align:center">
				<td><input type="checkbox" name="order_id[]" value="<?php echo $value['id'];?>" /></td>
				<td><font size="-6"><?php echo $value['payid'];?></font></td>
				<td align="left">
					商家名称:<a href="<?php echo $this->_url('shop/index/'.$value['shop_id']);?>" target="_blank"><?php echo $value['shop_name'];?>
				</td>
				<td><?php echo $value['transport_price'];?></td>
				<td><?php echo $value['order_amount'];?></td>
				<td><?php echo $value['pay_name'];?><br /><?php echo substr($value['order_time'],0,16);?></td>
				<td>
	
				 <?php 
	            	    if($value['order_status']==0){
							echo "<span class='black'>订单已取消</span><br />";
						} elseif($value['protect_status']==1) {
							echo "<span class='red'>维权中</span><br />";
						}elseif($value['protect_status']==2) {
							echo "<span class='red'>同意维权</span><br />";
						} elseif($value['protect_status']==3) {
							echo "<span class='red'>维权结束</span><br />";
						} elseif($value['order_status']==3) {
							echo "<span class='green'>已完成购买</span><br />";
						}else {
							if($value['pay_status']==0) {
								echo "<span class='red'>未支付</span><br /> ";
							} elseif($value['pay_status']==2){
								echo "<span class='red'>待退款</span><br /> ";
							} elseif($value['pay_status']==3){
								echo "<span class='red'>已退款</span><br /> ";
							} elseif($value['pay_status']==4){
								echo "<span class='red'>退款成功</span><br /> ";
							}else {
								if($value['transport_status']) {
									echo "<span class='red'>已发货</span><br /> ";
								} else {
									echo "<span class='red'>未发货</span><br />";
								}
							}	
					    }
				
				?>
				</td>
				<td>
					<?php if($value['order_status']!=0 && $value['order_status']!=3) {?>
						<a href="<?php echo $this->_url('admin/order/editdate/?id='.$value['id']);?>">修改</a><br />
					<?php }?>
					<a href="<?php echo $this->_url('admin/order/ordershow/?id='.$value['id']);?>">查看</a>
				</td>
			</tr>
			<?php }} else { ?>
			<tr>
				<td colspan="11">暂无信息</td>
			</tr>
			<?php } ?>
			<tr>
				<td colspan="11">
					<a href="<?php echo $result['page']['head'];?>">首页</a> 
                            <a href="<?php echo $result['page']['prevPage'];?>">上一页</a> 
                            <?php foreach($result['page']['plist'] as $k => $v ) { ?>							
                            <a href="<?php echo $v; ?>"><?php echo $k; ?></a>
							<?php } ?>
                            <a href="<?php echo $result['page']['nextPage'];?>">下一页</a> 
                            <a href="<?php echo $result['page']['foot'];?>">尾页</a> 
                            当前第<?php echo $result['page']['current']['num'];?>页/共<?php echo $result['page']['pageCount'];?>页				
				</td>
			</tr>
			<tr>
				<td colspan="11">
				<span style="margin:14px 14px 0px 0px; float:left;" >
					<select name="status">
						<option value="0">选择状态</option>
						<option value="cancel">取消订单</option>
						<option value="pay">已付款</option>
						<option value="nopay">未付款</option>
						<option value="transport">已发货</option>
						<option value="notransport">未发货</option>
					</select>
				</span>
				<span class="button-container"><input class="regular-button" type="submit" name="pay" value=" 设置状态" /></span>
				</td>
			</tr>
			</tbody>
		</table>
		</form>
		</div>
	  </div>
		
		
	</div>
</div>
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js'); ?>"></script>
<script language="JavaScript">
<!--
var inputs = document.getElementsByTagName("input");
function submitform() {
	var status = document.getElementsByName("status")[0];
	var checknum = 0;
	if(status.value==0) {
		ShowMessageBox("请选择您要设置的状态",'0');
		return false;
	} else {
		for(var i=0; i<inputs.length; i++) {
			if(inputs[i].type=='checkbox') {
				if(inputs[i].checked) {
					checknum++;
				}
			}
		}
		if(checknum==0) {
			ShowMessageBox(" 致少要选择一项，才能进行操作！",'0');
			return false;
		}
	}
	return true;
}

//-->
</script>
</body>
</html>